package com.iman.manjusri.mappers;

import com.iman.manjusri.mappers.models.DrmBuyCart;
import com.iman.manjusri.mappers.models.DrmBuyCartExample;
import com.iman.manjusri.mappers.models.DrmBuyCartKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface DrmBuyCartMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    int countByExample(DrmBuyCartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    int deleteByExample(DrmBuyCartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    @Delete({
        "delete from drm_buy_cart",
        "where cart_id = #{cartId,jdbcType=BIGINT}",
          "and course_id = #{courseId,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(DrmBuyCartKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    @Insert({
        "insert into drm_buy_cart (cart_id, course_id, ",
        "user_id, cart_st, put_time, ",
        "cancel_dt, pay_dt, ",
        "cart_tp)",
        "values (#{cartId,jdbcType=BIGINT}, #{courseId,jdbcType=BIGINT}, ",
        "#{userId,jdbcType=BIGINT}, #{cartSt,jdbcType=INTEGER}, #{putTime,jdbcType=TIMESTAMP}, ",
        "#{cancelDt,jdbcType=TIMESTAMP}, #{payDt,jdbcType=TIMESTAMP}, ",
        "#{cartTp,jdbcType=INTEGER})"
    })
    int insert(DrmBuyCart record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    int insertSelective(DrmBuyCart record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    List<DrmBuyCart> selectByExample(DrmBuyCartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    @Select({
        "select",
        "cart_id, course_id, user_id, cart_st, put_time, cancel_dt, pay_dt, cart_tp",
        "from drm_buy_cart",
        "where cart_id = #{cartId,jdbcType=BIGINT}",
          "and course_id = #{courseId,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    DrmBuyCart selectByPrimaryKey(DrmBuyCartKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    int updateByExampleSelective(@Param("record") DrmBuyCart record, @Param("example") DrmBuyCartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    int updateByExample(@Param("record") DrmBuyCart record, @Param("example") DrmBuyCartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    int updateByPrimaryKeySelective(DrmBuyCart record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_buy_cart
     *
     * @mbggenerated Thu Apr 02 21:31:19 CST 2015
     */
    @Update({
        "update drm_buy_cart",
        "set user_id = #{userId,jdbcType=BIGINT},",
          "cart_st = #{cartSt,jdbcType=INTEGER},",
          "put_time = #{putTime,jdbcType=TIMESTAMP},",
          "cancel_dt = #{cancelDt,jdbcType=TIMESTAMP},",
          "pay_dt = #{payDt,jdbcType=TIMESTAMP},",
          "cart_tp = #{cartTp,jdbcType=INTEGER}",
        "where cart_id = #{cartId,jdbcType=BIGINT}",
          "and course_id = #{courseId,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(DrmBuyCart record);
}